package a.f.h.d;

import a.c.e;
import a.c.k;
import a.c.w;
import a.c.x;
import a.f.h.b.f;
import a.i.n;

import java.awt.*;

class g
  implements y
{
  private f a;
  private x b;
  private x c;
  private x d;
  private int e;
  private int f;
  
  public g(int paramInt)
  {
    this.f = paramInt;
  }
  
  public void a(f paramf)
  {
    int i9 = j.r;
    boolean bool = j.q;
    n.a(this, "Prescribed size model !");
    this.a = paramf;
    a.f.o localo = (a.f.o)paramf.a();
    this.b = localo.B();
    this.c = localo.B();
    this.d = localo.B();
    double d1 = this.f;
    k localk1 = localo.c(o.t);
    k localk2 = localo.c("MIN_DIST_DP_KEY");
    w localw = localo.v();
    e locale;
    int k;
    label146:
    int m;
    int n;
    label243:
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      if (bool) {
        break label613;
      }
      if (paramf.d(locale))
      {
        this.b.a(locale, true);
        int[][] arrayOfInt = paramf.l(locale);
        int[] arrayOfInt1 = new int[4];
        k = 0;
        if (k < 4) {}
        while (i9 != 0)
        {
          m = arrayOfInt[k][0];
          n = arrayOfInt[k][2];
          if (bool) {
            break label146;
          }
          if (m == n)
          {
            arrayOfInt1[k] = m;
            if (i9 != 0) {
              break label243;
            }
            if (!bool) {}
          }
          else
          {
            if (i9 == 0) {}
            i1 = m < n ? n : m;
            arrayOfInt1[k] = Math.max(0, i1 - (1 - arrayOfInt[k][1]));
          }
          k++;
          if (!bool) {
            break;
          }
        }
        if (i9 == 0)
        {
          k = 0;
          if (localk1 != null) {
            k = localk1.getInt(locale);
          }
        }
        m = 0;
        n = 0;
        int i1 = 0;
        int i2 = 0;
        if ((i9 != 0) || (localk2 != null))
        {
          h.a_ locala_2 = (h.a_)localk2.get(locale);
          if (i9 == 0)
          {
            if (locala_2 != null)
            {
              m = locala_2.a();
              n = locala_2.b();
              i1 = locala_2.c();
            }
          }
          else {
            i2 = locala_2.d();
          }
        }
        if (i9 == 0) {}
        int i3 = arrayOfInt1[1] > arrayOfInt1[3] ? arrayOfInt1[1] : arrayOfInt1[3];
        if (i9 == 0) {}
        int i4 = arrayOfInt1[0] > arrayOfInt1[2] ? arrayOfInt1[0] : arrayOfInt1[2];
        double d4 = (localo.s(locale) - i1 - i2) / 2.0D;
        double d5 = (localo.t(locale) - m - n) / 2.0D;
        if (i9 == 0)
        {
          if (k > Math.min(d4, d5)) {
            k = (int)Math.floor(Math.min(d4, d5));
          }
          d4 -= k;
        }
        d5 -= k;
        double d6 = 2147483647.0D;
        double d7 = 2147483647.0D;
        if (i9 == 0) {
          if (i3 > 0) {
            d7 = d5 / i3;
          }
        }
        if (i9 == 0) {
          if (d7 < d1) {
            d1 = d7;
          }
        }
        if (i9 == 0) {
          if (i4 > 0) {
            d6 = d4 / i4;
          }
        }
        if (i9 != 0) {
          continue;
        }
        if (d6 < d1)
        {
          d1 = d6;
          if (i9 != 0) {
            continue;
          }
          if (!bool) {}
        }
      }
      else
      {
        this.b.a(locale, false);
      }
      localw.f();
    } while (!bool);
    if (i9 == 0) {
      if (d1 == 0.0D) {
        label613:
        d1 = 1.0D;
      }
    }
    if (i9 == 0) {
      if (d1 > 1.0D)
      {
        d1 = Math.floor(d1);
        if (i9 != 0) {
          break label672;
        }
        if (!bool) {
          break label653;
        }
      }
    }
    d1 = 1.0D / Math.ceil(1.0D / d1);
    label653:
    this.e = ((int)Math.ceil(this.f / d1));
    label672:
    d1 = this.f / this.e;
    localw = localo.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      if (i9 == 0)
      {
        if (paramf.d(locale))
        {
          int i = 0;
          if ((i9 != 0) || (localk1 != null)) {
            i = localk1.getInt(locale);
          }
          int j = 0;
          k = 0;
          m = 0;
          n = 0;
          if ((i9 != 0) || (localk2 != null))
          {
            h.a_ locala_1 = (h.a_)localk2.get(locale);
            if (i9 == 0)
            {
              if (locala_1 != null)
              {
                j = locala_1.a();
                k = locala_1.b();
                m = locala_1.c();
              }
            }
            else {
              n = locala_1.d();
            }
          }
          double d2 = localo.s(locale) / 2.0D;
          double d3 = localo.t(locale) / 2.0D;
          int i5 = (int)Math.ceil(d2 / this.f) * 2;
          int i6 = (int)Math.ceil(d3 / this.f) * 2;
          if (i9 == 0) {
            if (i > Math.min((2.0D * d2 - m - n) / 2.0D, (2.0D * d3 - j - k) / 2.0D)) {
              i = (int)Math.floor(Math.min((2.0D * d2 - m - n) / 2.0D, (2.0D * d3 - j - k) / 2.0D));
            }
          }
          int i7 = (int)(i5 * this.e / 2 - Math.floor((d2 - i) / d1));
          int i8 = (int)(i6 * this.e / 2 - Math.floor((d3 - i) / d1));
          this.d.a(locale, new Dimension(i7, i8));
          this.c.a(locale, new Dimension(i5, i6));
        }
        localw.f();
      }
    } while (!bool);
  }
  
  public boolean a()
  {
    return false;
  }
  
  public int e(e parame)
  {
    Dimension localDimension = (Dimension)this.d.get(parame);
    return localDimension.width;
  }
  
  public int f(e parame)
  {
    Dimension localDimension = (Dimension)this.d.get(parame);
    return localDimension.height;
  }
  
  public boolean a(e parame)
  {
    return this.b.getBool(parame);
  }
  
  public int c(e parame)
  {
    Dimension localDimension = (Dimension)this.c.get(parame);
    return localDimension.width;
  }
  
  public int d(e parame)
  {
    Dimension localDimension = (Dimension)this.c.get(parame);
    return localDimension.height;
  }
  
  public boolean b(e parame)
  {
    return a(parame);
  }
  
  public double b()
  {
    return this.e;
  }
  
  public int c()
  {
    return 1;
  }
  
  public boolean d()
  {
    return true;
  }
  
  public void e()
  {
    this.a.a().a(this.b);
    this.a.a().a(this.c);
    this.a.a().a(this.d);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.d.g

 * JD-Core Version:    0.7.0.1

 */